*******************************************************
* Lyle 05 Jan 11: 						              *
*	-this program serves as a base shell for all	  *
*	 stata do files					                  *
*******************************************************

* do c:/users/Jordan.Becker/Desktop/GD/20131028PubOpStratCult/do/PubOpStratCult.do*

********************************
* Standard Stata Configuration *
********************************
clear all
set mem 999m
capture log close
set logtype text
cap cd "C:\Users\ejm5\Google Drive\2017_Research\Unemployment_MILEX"
cap cd "C:\Users\Jordan.Becker\Desktop\GD\2017_Research\Unemployment_MILEX"
cap cd "\\usnatonetapp01.eur.state.sbu\profiles\beckerjm\Desktop\2017_Research\Unemployment_MILEX"
log using "log\WOTR.log", replace


*********************
* Prepare Variables *
*********************
use "dta\2017_uem", clear
sort ccode year
xtset ccode year


********************
* Analyze the Data *
********************
set more off
sort ccode year
xtset ccode year






*************SUSTAINABILITY*******************************************************************************

*Figure 6a: Bivariate Relationship between Equipment Share and EDA sustainability*
#delimit;
use "dta\2017_uem", clear;
sort ccode year;
xtset ccode year;
preserve;
keep if eda_sustainability!=. & eda_sustainability<=100;
corr eda_sustainability l3.equipment;
#delimit;
twoway (lfit eda_sustainability l3.equipment) 
(scatter eda_sustainability l3.equipment, msymbol(diamond) mcolor(navy) msize(medsmall)), note(R=0.283)
xtitle("", size(medsmall) margin(medsmall))
ytitle("", size(small) margin(medsmall))
legend(rows(2) size(vsmall) position(2) ring(0) label(1 Fitted) label(2 Observed))
title("A: All Country-Years (3-year lag on DV)", size(medlarge));
graph save output\equipment_sustainability_a.gph, replace;
restore;


*Figure 6b: Mean Bivariate Relationship between Equipment Share and EDA sustainability*
#delimit;
preserve;
keep if eda_sustainability!=.;
collapse equipment eda_sustainability, by (countryname);
corr eda_sustainability equipment;

#delimit;
twoway (lfit eda_sustainability equipment) 
(scatter eda_sustainability equipment, msymbol(diamond) mcolor(navy) msize(medsmall) mlabsize(vsmall) mlabcolor(black) mlabel(countryname)), note(R=0.581)
xtitle("", size(medsmall) margin(medsmall))
ytitle("", size(medium) margin(medsmall))
legend(off)
title("B: Mean 2006-2014", size(medlarge));

graph save output\equipment_sustainability_b.gph, replace;

#delimit;
graph combine output\equipment_sustainability_a.gph output\equipment_sustainability_b.gph, 
cols(3) ycommon iscale(tiny) imargin(tiny)
title("Equipment (% Defense Spending)", size(medlarge) margin(medsmall) color(black) position(6))
subtitle("EDA sustainability (Sustainable Land Forces/Total Military Personnel)", size(vsmall) position(9) orientation(vertical) margin(medsmall) color(black));
graph save output\equipment_sustainability, replace;
restore;


*Deployability and Sustainability Trends*
#delimit;
preserve;
keep if year>=2006 & year<=2014 & eda_deployability!=. & eda_sustainability!=.;
collapse eda_deployability eda_sustainability force_thousands, by(year);
tsline eda_deployability eda_sustainability force_thousands;
graph save output\tsline_deploy_sustain, replace;
restore;




